<?php
/**
 * Created by PhpStorm.
 * User: User
 * Date: 2017/10/9
 * Time: 18:25
 */
class Circle
{
    private $name;
    private  $set;
    private $r;

    public  function  getArea(){
        return 3.14*$this->r*$this->r;

    }
public function __set($name, $value)
{
    if($name=='r'&& $value<0)
    {
        $this->r=0;
    }else
        {
        $this->$name=$value;
    }
}

}
$c=new Circle();
$c->r=3;
print $c->getArea();
print  '<br/>';
$c->r=-3;
print $c->getArea();